﻿using BCDto.Common.ErrorMessage;
using BCDto.TMS.Driver.VehicleBusiness;
using BCService.TMS.VehicleBusinessMappingOverwrite;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace BCTMSRESTful.Controllers.DriverApp.VehicleTransportBusiness
{
    /// <summary>
    /// 车辆运输业务
    /// </summary>
    [Route("api/v1/DriverApp/[controller]")]
    [ApiExplorerSettings(GroupName = "DriverApp")]
    public class VehicleTransportBusinessController : DriverAppBaseController
    {
        private readonly IVehicleBusinessMappingOverwriteService vehicleBusinessMappingOverwriteService;

        public VehicleTransportBusinessController(IVehicleBusinessMappingOverwriteService vehicleBusinessMappingOverwriteService)
        {
            this.vehicleBusinessMappingOverwriteService = vehicleBusinessMappingOverwriteService;
        }

        /// <summary>
        /// 获取当前司机所在区县下的车辆列表
        /// </summary> 
        /// <response code="200">获取当前司机所在区县下的车辆列表</response>
        /// <returns></returns>
        [HttpGet("{county_code}")]
        [ProducesResponseType(typeof(IEnumerable<VehicleBusinessMappingForAppDto>), 200)]
        [ProducesResponseType(typeof(ErrorMessageDto), 400)]
        [ProducesResponseType(typeof(ErrorMessageDto), 500)]
        public IActionResult Query([FromRoute(Name = "county_code")] string countyCode)
        {
            var result = this.vehicleBusinessMappingOverwriteService.GetDistinctList(countyCode);
            return this.Ok(result);
        }

    }
}
